#include "my_application.h"
#include <QtGui>

my_application::my_application(int &argc, char **argv)
    : QApplication(argc, argv)
{
}

bool my_application::notify(QObject *receiver, QEvent *event)
{
    if(event->type() == QEvent::MouseButtonPress)
    {
        auto mouse_event = dynamic_cast<QMouseEvent*>(event);
        auto widget = qobject_cast<QWidget*>(receiver);

        if(mouse_event && widget)
            qDebug() << widget->mapToGlobal(mouse_event->pos());
    }

    QApplication::notify(receiver, event);
}
